﻿<Window x:Class="UI.Dialogs.AuthorForm"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Author" Height="413" Width="684" 
        xmlns:InfraControls="clr-namespace:Infrastructure.Controls;assembly=Infrastructure" 
        xmlns:UIControls="clr-namespace:UI.Controls">
    <Window.Resources>
        <Style TargetType="{x:Type TextBox}">
            <Setter Property="Validation.ErrorTemplate">
                <Setter.Value>
                    <ControlTemplate>
                        <DockPanel LastChildFill="True">
                            <Border BorderBrush="Red" BorderThickness="2">
                                <AdornedElementPlaceholder />
                            </Border>
                        </DockPanel>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="Validation.HasError" Value="true">
                    <Setter Property="ToolTip" 
                        Value="{Binding RelativeSource={RelativeSource Self}, 
                        Path=(Validation.Errors)[0].ErrorContent}"/>
                    <Setter Property="Background"
                            Value="AntiqueWhite" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    
    <DockPanel LastChildFill="True">
        <UIControls:OkCancel x:Name="okCancel" DockPanel.Dock="Bottom" CancelClicked="okCancel_CancelClicked" OkClicked="okCancel_OkClicked" />
        <TabControl Name="tabControl1" TabStripPlacement="Left">
            <TabItem Header="Basic" Name="basic">
                <ScrollViewer VerticalScrollBarVisibility="Auto" >
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                            
                        </Grid.ColumnDefinitions>
                        <GridSplitter x:Name="gridSplitter" 	
                                      HorizontalAlignment="Right" 
                                      VerticalAlignment="Stretch"
                                      Grid.Column="1" 
                                      Grid.RowSpan="7"
                                      ResizeBehavior="PreviousAndNext" 
                                      Width="5" />
                        <GroupBox Grid.Column="0"
                                  Grid.Row="0" 
                                  Header="Basic" >
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                
                                <Label Grid.Row="0" Content="Title:" />
                                <Label Grid.Row="1" Content="Firstname:" />
                                <Label Grid.Row="2" Content="Middle name:" />
                                <Label Grid.Row="3" Content="Last name:" />
                                <Label Grid.Row="4" Content="Position:" />
                                
                                <TextBox Name="Title" 
                                         Grid.Column="1" 
                                         Grid.Row="0"
                                         Text="{Binding Title, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}"/>
                                <TextBox Name="FirstName" 
                                         Grid.Column="1" 
                                         Grid.Row="1"
                                         Text="{Binding FirstName, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}"/>
                                <TextBox Name="MiddleName" 
                                         Grid.Column="1" 
                                         Grid.Row="2"
                                         Text="{Binding MiddleName, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}"/>
                                <TextBox Name="LastName" 
                                         Grid.Column="1" 
                                         Grid.Row="3"
                                         Text="{Binding LastName, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}"/>
                                <TextBox Name="Position" 
                                         Grid.Column="1" 
                                         Grid.Row="4"
                                         Text="{Binding Position, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}"/>
                            </Grid>
                        </GroupBox>
                        <GroupBox Grid.Row="1" 
                                  Header="Phone">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <DataGrid Name="Phones" 
                                          HeadersVisibility="None"
                                          MinHeight="20"/>
                                <Button Grid.Row="1"
                                        Content="Add"
                                        Margin="5, 2, 2, 5"/>
                            </Grid>
                        </GroupBox>
                        <GroupBox Grid.Row="2" 
                                  Header="Address">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <DataGrid Name="Addresses" 
                                          HeadersVisibility="None"
                                          MinHeight="20"
                                          ItemsSource="{Binding Addresses}"
                                          AutoGenerateColumns="False" 
                                          CanUserAddRows="False">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn CanUserResize="False" Header="Header" Binding="{Binding Uri}" />
                                    </DataGrid.Columns>
                                </DataGrid>
                                <Button Grid.Row="1"
                                        Content="Add"
                                        Margin="5, 2, 2, 5"/>
                            </Grid>
                        </GroupBox>
                        <GroupBox Grid.Row="3" 
                                  Header="Institution">
                        </GroupBox>

                        <GroupBox Grid.Column="2" 
                                  Header="Email">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <DataGrid Name="Emails" 
                                          HeadersVisibility="None"
                                          MinHeight="20" 
                                          MinRowHeight="10"
                                          ItemsSource="{Binding Emails}"
                                          AutoGenerateColumns="False" 
                                          CanUserAddRows="False">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn CanUserResize="False" Header="Header" Binding="{Binding EmailAddress}" />
                                    </DataGrid.Columns>
                                </DataGrid>
                                <Button Grid.Row="1"
                                        Content="Add"
                                        Margin="5, 2, 2, 5" Click="Button_Click"/>
                            </Grid>
                        </GroupBox>
                        <GroupBox Grid.Column="2" 
                                  Grid.Row="1"
                                  Header="Websites">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <DataGrid Name="Websites" 
                                          HeadersVisibility="None"
                                          MinHeight="20"
                                          ItemsSource="{Binding Websites}"
                                          AutoGenerateColumns="False"
                                          CanUserAddRows="False">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn CanUserResize="False" Header="Header" Binding="{Binding Uri}" />
                                    </DataGrid.Columns>
                                </DataGrid>
                                <Button Grid.Row="1"
                                        Content="Add"
                                        Margin="5, 2, 2, 5"/>
                            </Grid>
                        </GroupBox>
                        <InfraControls:RtfEditor Name="Comment"
                                      Grid.Row="2"
                                      Grid.RowSpan="2"
                                      Grid.Column="2"/>
                    </Grid>
                </ScrollViewer>
            </TabItem>
            <TabItem Header="Images">
                
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>
